#ifndef _RW_REG_H_
#define _RW_REG_H_

#include <windows.h>
#include <string>
#include <tchar.h>

//#ifndef CString
//#ifdef _UNICODE
//#define CString std::wstring
//#else
//#define CString std::string
//#endif
//#endif

//////////////////////////////////////////////////////////////////
// rw_reg
//////////////////////////////////////////////////////////////////
class rw_reg
{
public:
	static BOOL GetRegStr(
		CString strKeyName,
		CString strValueName,
		CString& strValue,
		DWORD dwMaxLength = 260,
		HKEY hKeyParent = HKEY_CURRENT_USER);

	static BOOL GetRegDWORD(
		CString strKeyName,
		CString strValueName,
		DWORD& dwValue,
		HKEY hKeyParent = HKEY_CURRENT_USER);

	static BOOL GetRegBinary(
		CString strKeyName,
		CString strValueName,
		BYTE* pBuf,
		DWORD& dwBytes,
		HKEY hKeyParent = HKEY_CURRENT_USER);

	static BOOL SetRegStr(
		CString strKeyName,
		CString strValueName,
		CString strValue,
		HKEY hKeyParent = HKEY_CURRENT_USER);

	static BOOL SetRegDWORD(
		CString strKeyName,
		CString strValueName,
		DWORD dwValue,
		HKEY hKeyParent = HKEY_CURRENT_USER);

	static BOOL SetRegBinary(
		CString strKeyName,
		CString strValueName,
		BYTE* pBuf,
		DWORD dwBytes,
		HKEY hKeyParent = HKEY_CURRENT_USER);

	static BOOL DelRegSubKey(
		CString strKeyName,
		CString strSubKey,
		HKEY hKeyParent = HKEY_CURRENT_USER,
		bool bRecurse = false);

	static BOOL DelRegValue(
		CString strKeyName,
		CString strValueName,
		HKEY hKeyParent = HKEY_CURRENT_USER);

private:
	rw_reg();
};

#endif
